<?php

use think\facade\Route;

Route::group('distributor', function () {

    /** 经销商管理 */
    Route::group(function () {

        // 经销商列表
        Route::get('/distributor', 'v1.distributor.Distributor/index')->option(['real_name' => '经销商户列表']);
        // 经销商列表导出
        Route::get('/export', 'v1.distributor.Distributor/export')->option(['real_name' => '经销商列表导出']);
        // 新增经销商
        Route::post('/distributor/:id', 'v1.distributor.Distributor/save')->option(['real_name' => '新建或保存经销商']);

        //设置批量商品上架
        Route::put('/distributor/distributor_show', 'v1.distributor.Distributor/distributor_show')->option(['real_name' => '批量开启经销商']);
        //设置批量商品下架
        Route::put('/distributor/distributor_unshow', 'v1.distributor.Distributor/distributor_unshow')->option(['real_name' => '批量禁用经销商']);

        
        Route::get('/distributor/all', 'v1.distributor.Distributor/all')->option(['real_name' => '所有经销商']);

    })->option(['parent' => 'distributor', 'cate_name' => '经销商管理']);


    /** 经销商管理 */
    Route::group(function () {

        // 经销商审核列表
        Route::get('/distributor_audit', 'v1.distributor.DistributorAudit/index')->option(['real_name' => '经销商审核列表']);
        Route::get('/distributor_audit/export', 'v1.distributor.DistributorAudit/export')->option(['real_name' => '经销商审核列表导出']);
        Route::post('/distributor_audit', 'v1.distributor.DistributorAudit/audit')->option(['real_name' => '经销商审核']);

    })->option(['parent' => 'distributor', 'cate_name' => '经销商审核']);


})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
    \app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'product', 'mark_name' => '经销商管理']);